package cn.com.nes.site.controller.system;

import cn.com.nes.site.entity.PageData;
import cn.com.nes.site.entity.vo.system.IsDictValueInfoVO;
import cn.com.nes.site.service.system.dict.IsDictValueInfoService;
import cn.hutool.core.util.StrUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: ShenWei
 * @Date: 2024/04/01/9:50
 */
@Controller
@RequestMapping("/v2/system/dict")
public class IsDictValueInfoController {
    @Resource
    IsDictValueInfoService isDictValueInfoService;

    /**
     * 根据typeId查询字典树
     * @param vo
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/getDictValue",method = RequestMethod.GET)
    public PageData getDictValue(IsDictValueInfoVO vo){
        String manufactureId = vo.getUserInfo().getNes_companyId();
        String typeId = vo.getTypeId();
        if (StrUtil.isBlank(typeId)){
            return PageData.error("请传入typeId");
        }

        return isDictValueInfoService.getDictValue(manufactureId,typeId);
    }

}
